<?php
require_once('../models/Model.php');

class Comment extends Model{

    public function getComment($id){

        $sql = "select c.*,u.username from blog_comment as c left join blog_user as u on c.comment_id = u.id where c.blog_id =".$id;

        $mysql = $this->getMysql();

        $comment = $mysql->GetAll($sql);

        $mysql->close_connect();

        return $comment;
    }

    public function setComment($data)
    {
        $mysql = $this->getMysql();

        $table = 'blog_comment';

        $id = $mysql->Insert($table,$data);

        $mysql->close_connect();

        return $id;
    }

}